|
|
|
|
|
|
|
You can also designate one button as the cancel button, which is similar to the default button but works with the Esc key. To make a command button into a cancel button, set its Cancel property to True. As with default buttons, only one button on a form can be a cancel button. As you set the value of the Default or Cancel property of one button to True, the same property of all other buttons on the form is set to False. |
|
|
|
|
|
|
|
|
You use Visual Basic's CheckBox control to get an answer of either "yes" or "no" from the user. This control works like a light switch. Either it is on or it is off; there is no in between. When a check box is on, a check mark ( ) is displayed in the box. It indicates that the answer to the check box's corresponding question is "yes." When the check box is off, or unchecked, the box is empty, indicating an answer of "no." Check boxes also have a third state, grayed, which is represented by a check mark with a gray background. This is usually used to indicate that a partial choice (some, but not all, of a number of sub-choices) has been made. A user can uncheck a grayed check box; if he rechecks it, it becomes fully checked. Figure 4.6 shows check boxes exhibiting all three possible states. |
|
|
|
|
|
|
|
|
|
The check mark or empty box format is characteristic of the standard-form check box. If you set the check box's Style property to 1 - Graphical, pictures are used to indicate checked and unchecked. Graphical check boxes are illustrated in Figure 4.6 as well.  |
|
|
|
|
|
|
|
|
|
|
Figure 4.6
A check box can indicate a "yes" or "no" response to a question. |
|
|
|
|
|
|
|
|
Figure 4.6 shows graphical check boxes as well as standard check boxes. Two properties, Picture and DownPicture, determine the pictures displayed by a graphical check box. |
|
|
|
|
|
|
|
|
Option buttons, also called radio buttons, are like the buttons on a car radio; they exist in a group, and only one of them can be "selected" at a time. They are useful for presenting a fixed list of mutually exclusive choices. Try it yourself: Draw several option buttons on a form. Initially, each option button has the default value of False. However, notice that if you set the value of any one of them to True, and then subsequently set the value of a different button in the group to True, the one that was True will automatically become False, as shown in Figure 4.7. |
|
|
|
|
|
|
|
|
You can use option buttons in two basic ways in code: |
|
|
|
|
|